package quoridorGame;

public class Move {
	public String theMove;
	
	public Move (String move) {
		require(isValidFormat(move), "a move of valid format");
		this.theMove =  move;
	}
	
	private boolean isValidFormat(String move) {
		boolean evaluation = true;
		
		if (move.length() != 2) {
			evaluation = false;
		}
		
		if (move.indexOf(0) < 'a' || move.indexOf(0) > 'g') {
			evaluation = false;
		}
		
		if (!(Character.isDigit(move.indexOf(1)) )) {
			evaluation = false;
		}
		
		return evaluation;
	}
	
	//require function sourced from John Potter's labs
	private static void require (boolean b, String desc)
    {
        if (!b)
            throw new IllegalStateException ("require" + desc);
    }
	
}
